FROM --platform=linux/amd64 pytorch/pytorch
# Use a 'large' base container to show-case how to load pytorch and use the GPU (when enabled)

# Ensures that Python output to stdout/stderr is not buffered: prevents missing information when terminating
ENV PYTHONUNBUFFERED 1

RUN groupadd -r user && useradd -m --no-log-init -r -g user user
USER user

WORKDIR /tmp

COPY --chown=user:user requirements.txt /tmp
COPY --chown=user:user resources /tmp/resources

# You can add any Python dependencies to requirements.txt
RUN python -m pip install \
    --user \
    --no-cache-dir \
    --no-color \
    --requirement /tmp/requirements.txt

COPY --chown=user:user inference.py /tmp

ENTRYPOINT ["python", "inference.py"]
